<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <title>挂失中心</title>
    <style>
        :root {
            --primary-color: #165DFF;
            --secondary-color: #4080FF;
            --accent-color: #FF7D00;
            --text-color: #333333;
            --light-text: #666666;
            --bg-color: #F5F7FA;
            --card-bg: #FFFFFF;
            --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
            --border-radius: 12px;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Inter', sans-serif;
        }

        body {
            background-color: var(--bg-color);
            background-image: 
                radial-gradient(circle at 25% 25%, rgba(22, 93, 255, 0.03) 0%, transparent 50%),
                radial-gradient(circle at 75% 75%, rgba(22, 93, 255, 0.03) 0%, transparent 50%);
            background-attachment: fixed;
            min-height: 100vh;
            color: var(--text-color);
        }

        .header {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            padding: 20px 40px;
            background: rgba(255, 255, 255, 0.8);
            backdrop-filter: blur(10px);
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
            z-index: 10;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .logo {
            font-size: 24px;
            font-weight: 700;
            color: var(--primary-color);
            display: flex;
            align-items: center;
        }

        .logo i {
            margin-right: 10px;
            color: var(--accent-color);
        }

        .button {
            background-color: var(--primary-color);
            color: white;
            border: none;
            padding: 10px 20px;
            border-radius: var(--border-radius);
            cursor: pointer;
            text-decoration: none;
            transition: all 0.3s ease;
            margin-right: 15px;
            display: inline-flex;
            align-items: center;
        }

        .button:hover {
            background-color: var(--secondary-color);
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(22, 93, 255, 0.2);
        }

        .button i {
            margin-right: 5px;
        }

        .logout-button {
            background-color: #FF0000;
            color: white;
            border: none;
            padding: 10px 20px;
            border-radius: var(--border-radius);
            cursor: pointer;
            text-decoration: none;
            transition: all 0.3s ease;
            display: inline-flex;
            align-items: center;
        }

        .logout-button:hover {
            background-color: #CC0000;
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(204, 0, 0, 0.2);
        }

        .logout-button i {
            margin-right: 5px;
        }

        .nav-buttons {
            display: flex;
            align-items: center;
        }

        .container {
            max-width: 1400px;
            margin: 0 auto;
            padding: 120px 40px 40px;
        }

        h1 {
            font-size: 28px;
            font-weight: 700;
            margin-bottom: 30px;
            color: var(--primary-color);
        }

        form {
            background: var(--card-bg);
            border-radius: var(--border-radius);
            box-shadow: 0 8px 30px rgba(22, 93, 255, 0.15);
            padding: 30px;
            transition: all 0.3s ease;
            border: 1px solid rgba(22, 93, 255, 0.1);
            position: relative;
            overflow: hidden;
            margin-bottom: 20px;
        }

        form::before {
            content: "";
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 6px;
            background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
        }

        form:hover {
            transform: translateY(-8px);
            box-shadow: 0 12px 40px rgba(22, 93, 255, 0.2);
        }

        input[type="text"],
        input[type="tel"],
        input[type="password"] {
            width: 100%;
            padding: 10px 15px;
            border: 1px solid #E0E3E9;
            border-radius: var(--border-radius);
            font-size: 16px;
            transition: all 0.3s ease;
            margin-bottom: 15px;
        }

        input[type="text"]:focus,
        input[type="tel"]:focus,
        input[type="password"]:focus {
            outline: none;
            border-color: var(--primary-color);
            box-shadow: 0 0 0 3px rgba(22, 93, 255, 0.2);
        }

        select {
            width: 100%;
            padding: 10px 15px;
            border: 1px solid #E0E3E9;
            border-radius: var(--border-radius);
            font-size: 16px;
            transition: all 0.3s ease;
            margin-bottom: 15px;
        }

        select:focus {
            outline: none;
            border-color: var(--primary-color);
            box-shadow: 0 0 0 3px rgba(22, 93, 255, 0.2);
        }

        input[type="submit"] {
            background-color: var(--primary-color);
            color: white;
            border: none;
            padding: 10px 20px;
            border-radius: var(--border-radius);
            cursor: pointer;
            font-size: 16px;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        input[type="submit"]:hover {
            background-color: var(--secondary-color);
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(22, 93, 255, 0.2);
        }

        button {
            background-color: var(--primary-color);
            color: white;
            border: none;
            padding: 10px 20px;
            border-radius: var(--border-radius);
            cursor: pointer;
            font-size: 16px;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        button:hover {
            background-color: var(--secondary-color);
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(22, 93, 255, 0.2);
        }

        .footer {
            text-align: center;
            padding: 20px;
            color: var(--light-text);
            font-size: 14px;
            margin-top: 60px;
        }
    </style>
    <link href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css" rel="stylesheet">
    <script>
        document.addEventListener('DOMContentLoaded', function () {
            // 获取卡片选择下拉框
            const cardSelect = document.getElementById('card');
            // 遍历所有选项，根据IsReportLoss状态设置颜色
            Array.from(cardSelect.options).forEach(option => {
                const isLost = option.getAttribute('data-status') === '1';
                if (isLost) {
                    option.style.color = 'red';
                } else {
                    option.style.color = 'green';
                }
            });

            // 快捷补办按钮点击事件，显示/隐藏补办表单
            const reissueBtn = document.getElementById('reissue-btn');
            const reissueForm = document.getElementById('reissue-form');
            reissueBtn.addEventListener('click', function () {
                // 判断当前表单状态，显示则隐藏，隐藏则显示
                if (reissueForm.style.display === 'block') {
                    reissueForm.style.display = 'none';
                } else {
                    reissueForm.style.display = 'block';
                }
            });
        });
    </script>
</head>

<body>
    <!-- 顶部导航 -->
    <div class="header">
        <div class="logo">
            <i class="fa fa-bank"></i>
            安心银行
        </div>
        <div class="nav-buttons">
            <a href="/personal" class="button">
                <i class="fa fa-user-circle"></i> 个人中心
            </a>
            <a href="/" class="logout-button">
                <i class="fa fa-sign-out"></i> 退出登录
            </a>
        </div>
    </div>

    <!-- 主要内容 -->
    <div class="container">
        <h1>挂失中心</h1>

        <!-- 原有挂失/解挂表单 -->
        <form action="loss" method="POST" style="margin-bottom: 20px;">
            <input type="hidden" name="is_reissue" value="0">
            <!-- 复用身份验证框 -->
            <input type="text" name="pid" placeholder="请输入您的身份证：">
            <input type="tel" name="phone" placeholder="请输入您的电话号码：">
            <input type="password" name="password" placeholder="请输入账户密码：">
            <div>请确认您的个人信息无误</div>

            <!-- 选择要挂失/解除挂失的卡 -->
            <div>选择要挂失/解除挂失的卡</div>
            <select id="card" name="card">
                {% for card in user.card_info %}
                    <option value="{{ card.cardID }}" data-status="{{ card.IsReportLoss }}">
                        {{ '*' * 12 }}{{ card.cardID[-4:] }} ({{ '已挂失' if card.IsReportLoss == '1' else '正常' }})
                    </option>
                {% endfor %}
            </select>

            <input type="password" name="card_password" placeholder="请输入卡密码：">
            <input type="submit" value="提交挂失/解挂">
        </form>

        <!-- 快捷补办按钮 -->
        <button id="reissue-btn">快捷补办</button>
        <!-- 快捷补办表单，默认隐藏 -->
        <form id="reissue-form" action="loss" method="POST" style="display: none; margin-top: 20px;">
            <input type="hidden" name="is_reissue" value="1">
            <!-- 复用身份验证框 -->
            <input type="text" name="pid" placeholder="请输入您的身份证：">
            <input type="tel" name="phone" placeholder="请输入您的电话号码：">
            <input type="password" name="password" placeholder="请输入账户密码：">
            <div>请确认您的个人信息无误</div>

            <!-- 选择要补办的卡（需是冻结状态） -->
            <div>选择要补办的冻结卡片</div>
            <select id="card" name="card">
                {% for card in user.card_info %}
                    <option value="{{ card.cardID }}" data-status="{{ card.IsReportLoss }}">
                        {{ '*' * 12 }}{{ card.cardID[-4:] }} ({{ '已挂失（冻结）' if card.IsReportLoss == '1' else '正常' }})
                    </option>
                {% endfor %}
            </select>

            <input type="password" name="card_password" placeholder="请输入卡密码：">
            <input type="password" name="new_card_password" placeholder="请输入新卡密码（六位数字）：">
            <input type="submit" value="提交补办">
        </form>
    </div>

    <!-- 页脚 -->
    <div class="footer">
        © 2025 安心银行 
    </div>
</body>

</html>